<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:message key="titulo.pesquisa" var="title">
    <fmt:param>
        <fmt:message key="titulo.usuario" />
    </fmt:param>
</fmt:message>
<fmt:message key="acao.deletar" var="msgDelete">
    <fmt:param>
        <fmt:message key="entidade.usuario" />
    </fmt:param>
</fmt:message>
<%@ include file="/WEB-INF/jsp/includes/topo.jspf" %>
<script type="text/javascript">
    $(document).ready(function() {
        $(".formExcluir").bind("click", function() {
            if (confirm('${msgDelete}')) {
                this.submit();
            }
        });
        
        $("table.listagem").dataTable({
            "columns": [
                {
                    "width": "5%"
                },
                null,
                null,
                null,
                {
                    orderable: false,
                    width: "8%"
                },
                {
                	orderable: false,
                    "width": "8%"
                }
            ],
            
            "order": [[0, "asc"]],
            "oLanguage": {
                "sEmptyTable": "Nenhum registro encontrado na tabela",
                "sInfo": "Mostrar _START_ até _END_ do _TOTAL_ registros",
                "sInfoEmpty": "Mostrar 0 até 0 de 0 Registros",
                "sInfoFiltered": "(Filtrar de _MAX_ total registros)",
                "sInfoPostFix": "",
                "sInfoThousands": ".",
                "sLengthMenu": "Mostrar _MENU_ registros por pagina",
                "sLoadingRecords": "Carregando...",
                "sProcessing": "Processando...",
                "sZeroRecords": "Nenhum registro encontrado",
                "sSearch": "Pesquisar:",
                "oPaginate": {
                    "sNext": "Proximo",
                    "sPrevious": "Anterior",
                    "sFirst": "Primeiro",
                    "sLast": "Ultimo"
                },
                "oAria": {
                    "sSortAscending": ": Ordenar colunas de forma ascendente",
                    "sSortDescending": ": Ordenar colunas de forma descendente"
                }
            }
        
        });
        
    });
</script>
<form action="${path}/pages/usuario" method="get" accept-charset="UTF-8" id="pesqUsuario" class="formCadastro">
    <label><fmt:message key="campo.nome" /></label>
    <input type="text" name="entidade.nome" value="${entidade.nome}" size="50" />
    <label><fmt:message key="campo.matricula" /></label>
    <input type="text" name="entidade.matricula" value="${entidade.matricula}" size="30" />
    <label><fmt:message key="campo.orgao" /></label>
    <input type="text" name="entidade.orgao" value="${entidade.orgao}" size="20" />
    <input type="submit" value="<fmt:message key='acao.pesquisar' />"  />
    <input type="button" value="<fmt:message key='acao.limpar' />" onclick="javascript:window.location.assign('${path}/pages/usuario')" />
    <input type="button" value="<fmt:message key='acao.novo' />" onclick="javascript:window.location.assign('${path}/pages/usuario/novo')" />
</form>
<table border="1" class="listagem display">
    <thead>
        <tr>
            <th><fmt:message key="campo.id" /></th>
            <th><fmt:message key="campo.nome" /></th>
            <th><fmt:message key="campo.matricula" /></th>
            <th><fmt:message key="campo.orgao" /></th>
            <th><fmt:message key="acao.editar" /></th>
            <th><fmt:message key="acao.excluir" /></th>
        </tr>
    </thead>
    <tbody>
        <c:forEach items="${usuarioList}" var="usuario">
            <tr>
                <td class="center">${usuario.id}</td>
                <td>${usuario.nome}</td>
                <td>${usuario.matricula}</td>
                <td>${usuario.orgao}</td>
                <td class="center">
                    <a href="${path}/pages/usuario/buscar/${usuario.id}">
                        <img src="${path}/resources/imgs/editar.png" alt="editar" />
                    </a>
                </td>
                <td class="center">
                    <form class="formExcluir" action="${path}/pages/usuario/remover/${usuario.id}" method="POST">
                        <input type="hidden" name="_method" value="DELETE" />
                        <span>
                            <img src="${path}/resources/imgs/excluir.png" alt="excluir" />
                        </span>
                    </form>
                </td>
            </tr>
        </c:forEach>
    </tbody>
</table>
<%@ include file="/WEB-INF/jsp/includes/rodape.jspf" %>